import styles from '../configs/styles'
import React, {Component} from 'react'
import {View, Text, FlatList, TouchableOpacity, Image } from 'react-native'
import Icon from 'react-native-vector-icons/Ionicons'
export default Helper = {
  avatar: (uri) => {
    if (uri == '' || uri == null) {
      return require('../assets/images/avatar.jpeg')
    } else {
      return {uri: uri}
    }
  },
  replyColor: (reply)=>{
    const color = {
      '已批准': styles.text_blue,
      '批准': styles.text_blue,
      '未阅': styles.text_danger,
      '驳回': styles.text_danger,
      '已驳回': styles.text_danger,
      '提交': styles.text_danger,
      '草稿': styles.text_danger,
    }
    return color[reply] || styles.text_black
  },
  listBlankInfo: (data, noticeText = '没有数据!')=>{
    if(data ==null || data.length == 0){
      return (
        <View style={{flex: 1, alignItems: 'center', paddingTop: 100}}>
          <Icon name={'ios-search'} size={42} color={'grey'}/>
          <Text style={{color: 'grey'}}>{noticeText}</Text>
        </View>
      )
    }else{
      return null
    }
  }
}
